import csv
import pymongo


class Pipline:
    def __init__(self, uri="mongodb://localhost:27017/"):
        self.client = pymongo.MongoClient(uri)
        self.tweets_db = self.client["twitter_db"]
        # self.tweets_db_collection = self.tweets_db['tweets_Sanktionen_China']
        self.tweets_db_collection = self.tweets_db['tweets_China']

    # item_list：字典列表
    def insert_many(self, item_list):
        if (len(item_list))>0:
            self.tweets_db_collection.insert_many(item_list)

    # item：字典
    def insert_one(self, item):
        self.tweets_db_collection.insert_one(item)


